<template>
  <Header class="header">
    <div class="left">
      <div class="nav-wrap">
        <a v-for="(item, i) in navs" :key="i" @click="anchor(item.target)">
          {{ item.title }}
        </a>
      </div>
    </div>

    <div class="link-li">
      <a v-for="(item, i) in links" :key="i" :href="item.url">
        <img :src="importIcon(item.img)" />
      </a>
    </div>
  </Header>
</template>

<script lang="ts">
import Vue from 'vue';
import importIcon from '../import-icon';
import { Layout } from 'ant-design-vue';

const { Header } = Layout;

export default Vue.extend({
  components: {
    Header,
  },

  data() {
    return {
      links: [
        {
          img: '/icons/link1.png',
          url: '',
        },
        {
          img: '/icons/link2.png',
          url: '',
        },
        {
          img: '/icons/link3.png',
          url: '',
        },
        {
          img: '/icons/link4.png',
          url: '',
        },
      ],
      navs: [
        {
          title: 'HOF',
          target: 'hof',
        },
        {
          title: 'WTH',
          target: 'wth',
        },
        {
          title: 'Mint',
          target: 'mint',
        },
        {
          title: 'Roadmap',
          target: 'road',
        },
      ],
    };
  },
  methods: {
    importIcon,
    anchor(id) {
      let dom = document.getElementById(id);
      console.log(dom);
      if (dom) {
        dom.scrollIntoView();
      }
    },
  },
});
</script>

<style lang="less" scoped>
@media screen and (max-width: 850px) {
  .link-li {
    a {
      margin-right: 6px !important;
    }
    img {
      width: 19px !important;
      height: 19px !important;
    }
  }
  .header {
    height: 50px !important;
  }
  .nav-wrap {
    font-size: 12px !important;
    a {
      padding: 0 4px !important;
    }
  }
  .ant-layout-header {
    padding: 0 10px !important;
  }
}
.header {
  background: #fff;
  height: 84px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position:fixed;
  z-index: 1;
  width:100%;
  .left {
    display: flex;
    align-items: center;
    > a {
      width: 138px;
      margin-right: 170px;
      .logo {
        width: 100%;
      }
    }
  }

  .link-li {
    a {
      margin-right: 40px;
    }
    img {
      width: 40px;
      height: 40px;
    }
  }
}
.nav-wrap {
  font-size: 20px;
  a {
    padding: 0 25px;
    font-weight: 400;
    color: #0c0c0c;
    font-family: 'rowdies';
  }
}
</style>
